<template>
    <div>
        <div class="centre">
        <div class="container">
            <van-tabs v-model="active"  animated title-active-color=#ef3926 line-width=20px 
            sticky swipeable :offset-top="0">
              <van-tab 
              v-for="item in Tab" :key="item" 
              :title="item" 
              title-style=font-weight:bold;font-size:15px
              >
             <div class="main">
                <div class="content" v-if="Lists">
                    <div class="imgbox" v-for="(item) in Lists" :key="item.id">
                        <router-link tag="div" :to="'/details?id='+item.id" class="box">
                            <img :src="item.img" alt="" class="auto-img">
                        </router-link>
                        
                        <div class="title">
                            <router-link tag="p" :to="'/details?id='+item.id">{{item.title}}</router-link>
                            <div class="box">
                              <div class="left">
                                <div class="logo">
                                    <img src="../assets/img/icon_user_video_on.png" alt="" class="auto-img">
                                </div>
                                <span>{{item.name}}</span>
                              </div>
                              <div class="right">
                                ...
                              </div>
                                
                            </div>
                        </div>
                    </div>
                    
                    
                </div>
                
            </div>
  
              </van-tab>
              
            </van-tabs>
            
            <div class="nullbox"></div>
           <banner-list></banner-list>
        </div>
    </div>
    </div>
</template>

<script>
// import '../assets/font/iconfont.js'
import bannerList from '../components/bannerList.vue';
import { getLists } from "../api/lists";
export default {
    data() {
      return {
        Lists: null,
        active:1,
        Tab:['实时','精选','热门'],
        likess:true,
      };
    },
    methods:{
      // Likeicon(){
      //   let token = window.localStorage.getItem("token");
      //     if(!token){
      //       this.$router.push("/login")
      //     }else{
      //       this.likess=!this.likess;
      //       if(!this.likess){
      //         //定义id
      //         let id=this.$route.query.id;
      //         console.log(id);
      //         //获取当前id所在数组的下标
      //         let index=this.Lists.findIndex((item)=>item.id==id);
      //         // 当前文章数据
      //         console.log(this.Lists[index]);
      //       }
      //     }
      // },
      getListsFun(){
        getLists({id:this.$route.query.id}).then(data=>{
          this.Lists=data.data;
          console.log(this.Lists); 
        })
      }
    },
    components:{
      bannerList
    },
    created(){
      this.getListsFun();
    }
}
</script>

<style lang="scss">
.centre .box_foot{
  padding-left: 12px;
  padding-right: 10px;
}
.box_header {
  margin-top: 2px;
  position: sticky;
  top: 0;
  left: 0;
  padding-bottom: 5px;
  background-color: #fff;
  padding-left: 12px;
  padding-right: 10px;
}
.centre {
  .icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    fill: currentColor;
    overflow: hidden;
  }
  .box_header {
    .nav {
      display: flex;
      justify-content: space-between;
      margin-bottom: 5px;
      & > ul {
        display: flex;
        flex: 1;
        padding-left: 6px;
        justify-content: space-evenly;
        & > li {
          font-weight: 600;
          color: #7b7b7b;
          &.con {
            color: #ef3926;
          }
          &:hover {
            color: #ef3926;
            & > div {
              background-color: #ef3926;
            }
          }
          & > div {
            margin: 0 auto;
            margin-top: 9px;
            width: 20px;
            height: 3px;
            border-radius: 1px;
            &.con {
              background-color: #ef3926;
            }
          }
        }
      }
      .plus {
        cursor: pointer;
        width: 20px;
        height: 20px;
        margin-top: 4px;
        margin-left: 11px;
      }
    }
  }
  .box_foot {
    ul {
      li {
        margin-top: 20px;
        margin-bottom: 15px;
        display: flex;
        justify-content: space-between;
        .titlebox {
          margin-right: 20px;
          flex: 1;
          display: flex;
          flex-direction: column;
          justify-content: space-between;
          .title {
            font-weight: bold;
            margin-bottom: 16px;
            font-size: 17px;
          }
          .subtitle {
            span {
              color: #747474;
              font-weight: bold;
              font-size: 12px;
              &.con {
                color: red;
                font-size: 12px;
                font-weight: bold;
                margin-right: 5px;
              }
            }
          }
        }
        .imgbox {
          flex: 0.7;
          border-radius: 6px;
          overflow: hidden;
        }
      }
    }
  }
  footer {
    .number {
      .imgbox {
        background: url(../assets/img/icon_cyol_selected.png) no-repeat -1px -1px;
        width: 42px;
        height: 42px;
      }
    }
    & > div {
      &:nth-child(3) {
        a {
          color: red;
        }
      }
    }
  }
  .main {
    margin-left: 13px;
    // margin-right: 10px;
  }
  .content {
    // margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    .imgbox {
      border-radius: 5px;
      background-color: #fff;
      box-shadow: 0 0 7px #ccc;
      overflow: hidden;
      width: 47%;
      margin-top: 10px;
      margin-right: 10px;
      display: flex;
      flex-direction: column;
      &:first-child {
        margin-right: 10px;
      }
      .box {
        border-radius: 5px;
        overflow: hidden;
        flex: 1;
      }
      .title {
        
        box-sizing: border-box;
        padding: 10px;
        font-weight: bold;
        font-size: 14px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        flex: 0.7;
        p{
          padding-top: 2px;
          text-overflow: -o-ellipsis-lastline;
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-line-clamp: 2;
          -webkit-box-orient: vertical;      
        }
        span {
          font-size: 12px;
          color: #808080;
        }
        .box {
          display: flex;
          justify-content: space-between;
          align-items: flex-end;
          .left{
            display: flex;
          }
          .right{
            display: flex;
            margin-bottom: 4px;
          }
          .logo {
            width: 15px;
            height: 15px;
            border-radius: 50%;
            margin-right: 7px;
            border: 1px solid #747474;
          }
        }
        .icon {
          width: 18px;
          height: 18px;
        }
      }
    }
  }
}

</style>